home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The PC-SIG Library 10
/
The PC-Sig Library - Shareware for the IBM PC and Compatibles (PC-SIG)(Tenth Edition Disks 1-2804)(1991).iso
/
PC_SIGCD
/
22
/
4
/
DISK2247.ZIP
/
CBDDL102.ZIP
/
CBDDLP.RME
< prev
next >
Wrap
Text File
|
1990-07-03
|
8KB
|
261 lines
----------------------------------------------------------------------
| Citadel |
| 241 East Eleventh Street * Brookville, IN 47012 * 317-647-4720 |
| BBS 317-647-2403 |
----------------------------------------------------------------------
cbddlp is distributed in a single compressed file cbddlRL.zip; R and L
would be the release and level numbers, respectively. The ZIP data
compression utilities are needed to extract the individual files.
The following files are obtained by decompressing cbddlRL.zip:
cbddlp.rme preliminary information
rlsnotes.txt release notes
cbddlp cbddlp program (UNIX System V/386)
cbddlp.exe cbddlp program (MS-DOS)
rolodeck.ddl example ddl file
Citadel 90/07/03
----------------------------------------------------------------------
| cbddlp - cbase data definition language processor |
| Version 1.0.2 |
----------------------------------------------------------------------
======================================================================
COPYRIGHT
Copyright (c) 1989 Citadel.
Citadel
241 East Eleventh Street
Brookville, IN 47012
317-647-4720
BBS 317-647-2403
cbddlp is a support program for the cbase library. cbddlp itself as
well as the accompanying files are part of cbase, and are therefore
subject to the copyright restrictions of cbase; see the appropriate
file in the cbase distribution for this copyright information. The
latest version of cbase is available on the Citadel BBS.
======================================================================
Citadel 90/07/03
NAME
cbddlp - cbase data definition language processor
SYNOPSIS
cbddlp ddlfile
DESCRIPTION
The cbddlp command processes cbase data definition language (ddl)
files. A cbase database can be specified in a ddl file, which is
then processed using cbddlp to generate the C files required by
cbase to access that database. ddl files are conventionally
given a .ddl suffix, but this is not required by cbddlp. The C
files generated are given the same name as the ddl file except
for the suffix; a .h and a .i file are generated. The .h file is
to be included in every module accessing the database. The .i
file is to included in exactly one module of every program
that accesses the database.
There are three types of ddl statements: data file, index file,
and record. The syntax for the record statement is
record recname {
[[unique ]key] cbtype fldname[[size]];
...
};
recname is the name of the record. cbtype is the cbase data type
of the field. fldname is the name of the field, and must be
unique for a given database. size specifies the number of
elements for array data types; this may be either an integral
numeric literal (e.g., 24), or a macro which evaluates to an
integer (e.g., NAME_MAX). If a macro is used, its definition
must always precede the inclusion of the data definition .h file.
The key keyword specifies that an index is to be maintained on
this field. The unique keyword specifies that the keys in this
index must be unique. Multiple records can be defined in the
same ddl file.
User-defined data types may also be specified in a ddl file, but
require an additional piece of information. For the predefined
data types, cbddlp knows what the corresponding C data type is
(t_string : char, t_int : int, etc.). But for user-defined data
types, this must be explicitly specified. The syntax for this is
as follows.
[[unique ]key] usrtype:ctype fldname[[size]];
usrtype is the name of the user defined data type. ctype is the
corresponding C data type (char, int, long, etc.). ctype must
consist of only one identifier; If the C data type consists of
Citadel 90/07/03
multiple identifiers (e.g., long double), either #define or
typedef must be used to reduce it to one identifier (e.g.,
typedef long double ldouble).
The syntax for the data file statement is
data file "filename" contains recname;
filename is the name of the file in which recname records are to
be stored. The data file statement must precede its associated
record statement.
The syntax for the index file statement is
index file "filename" contains keyname;
filename is the name of the file in which keyname keys are to be
indexed. The index file statement must precede the record
statement containing the associated key.
In the headers generated by cbddlp, a macro for the cbase name
for a record is constructed by converting all lower case letters
in the record name to capitals. A macro is defined for each
field. The macro identifier is constructing by converting all
lower case letters in the field name to upper case. The initial
characters (up to four) of the first field name of a record
preceding the first underscore are used as the prefix for the
field count macro and field definition list. The field count
macro identifier is constructed by converting this prefix to
capitals and appending FLDC. The field definition list
identifier is constructed by appending fldv to the prefix.
ddl files can also contain C style comments.
EXAMPLE
Below is given an example ddl file for a rolodeck database
consisting of a single record.
Citadel 90/07/03
data file "rolodeck.dat" contains rolodeck;
index file "rdcont.ndx" contains rd_contact;
index file "rdcomp.ndx" contains rd_company;
record rolodeck { /* rolodeck record */
unique key t_string rd_contact[41]; /* contact name */
t_string rd_title[41]; /* contact title */
key t_string rd_company[41]; /* company name */
t_string rd_addr[81]; /* address */
t_string rd_city[26]; /* city */
t_string rd_state[3]; /* state */
t_string rd_zip[11]; /* zip code */
t_string rd_phone[13]; /* phone number */
t_string rd_ext[5]; /* phone extension */
t_string rd_fax[13]; /* fax number */
t_string rd_notes[161]; /* notes */
};
If the name of this ddl file was rolodeck.ddl, the generated C
files would be rolodeck.h and rolodeck.i. The cbase name macro
would be ROLODECK (the record identifier capitalized). The field
count macro would be RDFLDC. The field definition list would be
rdfldv. The rolodeck would be therefore be opened (for writing)
as follows.
cbopen(ROLODECK, "r+", RDFLDC, rdfldv);
DIAGNOSTICS
Exit status is 0 if the ddl file is processed with no errors,
otherwise 1.
NOTES
For a make utility to automatically process ddl files without an
explicit rule for each one, suffix rules defining the creation of
the data definition header files from a ddl file must be added to
the makefile. For the standard UNIX make, the following
instructions would be inserted near the beginning of the
makefile.
# suffix rules
.SUFFIXES: .ddl .h .i
.ddl.h:
cbddlp $<
.ddl.i:
cbddlp $<
The exact procedure for other make utilities vary. Also, the
documention may refer to suffix rules as implicit rules.
Citadel 90/07/03